/*
 /home/jenkins/agent/workspace/Panda/Pre_Merge_ETS_ARM_Tests/panda_src/runtime_core/static_core/tests/tests-u-runner/runner.sh --ets-es-checked --build-dir="/home/jenkins/agent/workspace/Panda/Pre_Merge_ETS_ARM_Tests/panda_src/artifacts/build" --processes=10 --work-dir=/home/jenkins/agent/workspace/Panda/Pre_Merge_ETS_ARM_Tests/archives/ets-es-checked --handle-timeout=True --es2panda-timeout=90 --aot --aot-args="--compiler-check-final=true" --aot-args="--compiler-ignore-failures=false" --timeout=60 --ark-args="--enable-an:force" --test-list-arch=ARM64 --force-generate --compare-files-iterations=2  --test-file float64array_newFloat64Array_newArrayBuffer_2_Float64Array_BYTES_PER_ELEMENT__0_0_pars_0.ets
*/
//cmake /home/jenkins/agent/workspace/Panda/Pre_Merge_Builds_Standalone1/panda_src/runtime_core/static_core -GNinja -DPANDA_C2ABC_UPGRADE_LEGACY=true -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/host_clang_14.cmake -DPANDA_LLVM_BACKEND=true -DLLVM_TARGET_PATH=/opt/llvm-15-debug-x86_64 -DPANDA_ETS_INTEROP_JS=true -DPANDA_WITH_ACCORD=false
//ninja -k1 -j16 cmake-checker test-cmake-checker clang-tidy-check code-style-check
//code/array_test/bench_ArrayMethods_fromBigFloat64Array.ets

    let arrUnion = new Array<TestClass | undefined>(5)
    arrUnion.fill(undefined, 0, 5)
    arrUnion.fill(new TestClass(2), 3, 5)
    for (let i = 0; i < 5; i++) {
        if (i < 3) {
            assertEQ(arrUndef[i], undefined);
            continue
        }
        if (arrUnion[i] instanceof TestClass) {
            let tmpObj = arrUnion[i] as TestClass
            assertEQ(tmpObj.get(), 2);
        }
    }


/**
 * @State
 * @Generator gen_test_class.py
 * @Tags StdLib, StdLib_Array
 */
export class ArrayMethods {
  longSize: number;
  bigFromFloat64Array: Float64Array = new Float64Array();

  public setupContainersForFrom() {
    this.bigFromFloat64Array = new Float64Array(this.longSize);
  }
  /**
   * @Setup
   */
  public setup(): void {
    this.longSize = 10000;
    this.setupContainersForFrom();;
  }

  /**
   * @Benchmark
   */
  public fromBigFloat64Array(): number {
    return Array.from(this.bigFromFloat64Array)[0];
  }

}


let WI: int = 2;
let MI: int = 3;
let IT: int = 1;
let WT: int = 1;
let FI: int = 0;
let SYS_GC_PAUSE: int = -1;

function log(msg: String): void {
    // timestamp is needed by GC parser
    let now: long = Date.now() as long;
    console.log(now + " " + msg);
}

function doGC(): void throws {
    if (SYS_GC_PAUSE >= 0) {
        log("Force GC");
        let gc = GC.startGC(GC.FULL_CAUSE);
        GC.waitForFinishGC(gc);
        log("Force GC");
        gc = GC.startGC(GC.FULL_CAUSE);
        GC.waitForFinishGC(gc);
        // No sleep in ETS: sleep(SYS_GC_PAUSE)
    }
}

const MAX_LOOP_COUNT: long = 1_000_000_000;
const MS2NS: long = 1_000_000;
const S2MS: long = 1_000;

let loopCount1: long = 0;

let totalOps: long = 0;
let totalMs: long = 0;
let iter: int = 0;

function runIters(phase: String, count: int, time: int): void throws {
    let iterMs: long = time * S2MS;
    totalOps = 0;
    totalMs = 0;

    for (let k: int = 0; k < count; k++) {
        let ops: long = 0;
        let elapsedMs: long = 0;
        doGC();
        let start: long = Date.now() as long;
        while (elapsedMs < iterMs) {
            for (let i: long = 0; i < loopCount1; i++) {
                Consumer.consume(bench.fromBigFloat64Array());
            }
            elapsedMs = (Date.now() as long) - start;
            ops += loopCount1;
        }
        totalOps += ops;
        totalMs += elapsedMs;
        log(phase + " " + iter + ":" + ops + " ops, " + 1.0*elapsedMs*MS2NS/ops + " ns/op");
        iter++
    }
}

let bench = new ArrayMethods();

function main(): void throws {

    log("Startup execution started: " + (Date.now() as long));

    
    bench.setup();

    if (FI > 0) {
        log('Fast starting ArrayMethods_fromBigFloat64Array @ No Params...');
        let start: long = Chrono.nanoNow();
        for(let i: int = 0; i < FI; i++) {
            Consumer.consume(bench.fromBigFloat64Array());
        }
        let elapsed: long = Chrono.nanoNow() - start;
        if (elapsed <= 0) {
            elapsed = 1;  // 0 is invalid result
        }
        log("Benchmark result: ArrayMethods_fromBigFloat64Array " + 1.0*elapsed/FI);
        Consumer.consume(bench);
        return;
    }

    log('Starting ArrayMethods_fromBigFloat64Array @ No Params...');

    let iterMs: long = 1 * S2MS;
    let loopMs: long = 0;
    let loopCount: long = 1;

    while (loopMs < iterMs && loopCount < MAX_LOOP_COUNT) {
        loopCount = loopCount * 2;
        let start: long = Date.now() as long;
        for (let i = 0; i < loopCount; i++) {
            Consumer.consume(bench.fromBigFloat64Array());
        }
        loopMs = (Date.now() as long) - start;
    }

    loopCount1 = loopCount * iterMs / loopMs;
    if (loopCount1 == 0) {
        loopCount1++;
    }

    log("Tuning: " +  loopCount + " ops, " + 1.0*loopMs*MS2NS/loopCount + " ns/op => "
        + loopCount1 + " reps");

    if (WI > 0) {
        iter = 1;
        // Re-entering runIters in warmup loop to allow profiler complete the method.
        // Possible deoptimizations and recompilations is done in warmup instead of measure phase.
        for (let wi: int = 0; wi < WI; ++wi) {
            runIters("Warmup", 1, WT);
        }
    }
    iter = 1;
    runIters("Iter", MI, IT);
    log("Benchmark result: ArrayMethods_fromBigFloat64Array " + 1.0*totalMs*MS2NS/totalOps);


    Consumer.consume(bench);

}

class Consumer {
    public static readonly x1: long = 0x41c64e6d;
    public static readonly x2: long = 0xd431;
    private static x3: long = 1;
    public static boola: boolean = false;
    public static boolb: boolean = true;
    public static chara: char = 88;  // 'X'
    public static charb: char = 89;  // 'Y'
    public static stra: string = 'X';
    public static strb: string = 'Y';
    public static bytea: byte = 24;
    public static byteb: byte = 53;
    public static shorta: short = 24;
    public static shortb: short = 53;
    public static inta: int = 24;
    public static intb: int = 53;
    public static longa: long = 24;
    public static longb: long = 53;
    public static floata: float = 24.0;
    public static floatb: float = 53.0;
    public static doublea: double = 24.0;
    public static doubleb: double = 53.0;
    public static localObj = new Object();
    public static localObjs: Object[] = [new Object()];
    public static pseudorand: long = Date.now() as long;

    public static consumeBool(boolc: boolean): void throws {
        if (boolc == Consumer.boola && boolc == Consumer. boolb) {
            throw new NullPointerError();
        }
    }

    public static consumeChar(charc: char): void throws {
        if (charc == Consumer.chara && charc == Consumer.charb) {
            throw new NullPointerError();
        }
    }

    public static consumeByte(bytec: byte): void throws {
        if (bytec == Consumer.bytea && bytec == Consumer.byteb) {
            throw new NullPointerError();
        }
    }

    public static consumeShort(shortc: short): void throws {
        if (shortc == Consumer.shorta && shortc == Consumer.shortb) {
            throw new NullPointerError();
        }
    }

    public static consumeInt(intc: int): void throws {
        if (intc == Consumer.inta && intc == Consumer.intb) {
            throw new NullPointerError();
        }
    }

    public static consumeLong(longc: long): void throws {
        if (longc == Consumer.longa && longc == Consumer.longb) {
            throw new NullPointerError();
        }
    }

    public static consumeFloat(floatc: float): void throws {
        if (floatc == Consumer.floata && floatc == Consumer.floatb) {
            throw new NullPointerError();
        }
    }

    public static consumeDouble(doublec: double): void throws {
        if (doublec == Consumer.doublea && doublec == Consumer.doubleb) {
            throw new NullPointerError();
        }
    }

    public static consumeObj(obj: Object): void throws {
        Consumer.pseudorand = (Consumer.pseudorand * Consumer.x1 + Consumer.x2);
        if ((Consumer.pseudorand & Consumer.x3) == 0) {
            Consumer.x3 = (Consumer.x3 << 1) + (0xad as long);
            Consumer.localObj = obj;
        }
    }

    public static consumeString(strc: string): void throws {
        if (strc === Consumer.stra && strc === Consumer.strb) {
            throw new NullPointerError();
        }
    }

    public static consumeObjs(objs: Object[]): void throws {
        Consumer.pseudorand = (Consumer.pseudorand * Consumer.x1 + Consumer.x2);
        if ((Consumer.pseudorand & Consumer.x3) == 0) {
            Consumer.x3 = (Consumer.x3 << 1) + (0xad as long);
            Consumer.localObjs = objs;
        }
    }

    public static consume(v: boolean): void throws {
        Consumer.consumeBool(v);
    }

    public static consume(v: byte): void throws {
        Consumer.consumeByte(v);
    }

    public static consume(v: char): void throws {
        Consumer.consumeChar(v);
    }

    public static consume(v: short): void throws {
        Consumer.consumeShort(v);
    }

    public static consume(v: int): void throws {
        Consumer.consumeInt(v);
    }

    public static consume(v: long): void throws {
        Consumer.consumeLong(v);
    }

    public static consume(v: float): void throws {
        Consumer.consumeFloat(v);
    }

    public static consume(v: double): void throws {
        Consumer.consumeDouble(v);
    }

    public static consume(v: Object): void throws {
        Consumer.consumeObj(v);
    }

    public static consume(v: Object[]): void throws {
        Consumer.consumeObjs(v);
    }

}


//code/array_test/bench_ArrayMethods_fromBigUint32Array.ets


/**
 * @State
 * @Generator gen_test_class.py
 * @Tags StdLib, StdLib_Array
 */
export class ArrayMethods {
  longSize: number;
  bigFromUint32Array: Uint32Array = new Uint32Array();

  public setupContainersForFrom() {
    this.bigFromUint32Array = new Uint32Array(this.longSize);
  }
  /**
   * @Setup
   */
  public setup(): void {
    this.longSize = 10000;
    this.setupContainersForFrom();;
  }

  /**
   * @Benchmark
   */
  public fromBigUint32Array(): number {
    return Array.from(this.bigFromUint32Array)[0];
  }

}


let WI: int = 2;
let MI: int = 3;
let IT: int = 1;
let WT: int = 1;
let FI: int = 0;
let SYS_GC_PAUSE: int = -1;

function log(msg: String): void {
    // timestamp is needed by GC parser
    let now: long = Date.now() as long;
    console.log(now + " " + msg);
}

function doGC(): void throws {
    if (SYS_GC_PAUSE >= 0) {
        log("Force GC");
        let gc = GC.startGC(GC.FULL_CAUSE);
        GC.waitForFinishGC(gc);
        log("Force GC");
        gc = GC.startGC(GC.FULL_CAUSE);
        GC.waitForFinishGC(gc);
        // No sleep in ETS: sleep(SYS_GC_PAUSE)
    }
}

const MAX_LOOP_COUNT: long = 1_000_000_000;
const MS2NS: long = 1_000_000;
const S2MS: long = 1_000;

let loopCount1: long = 0;

let totalOps: long = 0;
let totalMs: long = 0;
let iter: int = 0;

function runIters(phase: String, count: int, time: int): void throws {
    let iterMs: long = time * S2MS;
    totalOps = 0;
    totalMs = 0;

    for (let k: int = 0; k < count; k++) {
        let ops: long = 0;
        let elapsedMs: long = 0;
        doGC();
        let start: long = Date.now() as long;
        while (elapsedMs < iterMs) {
            for (let i: long = 0; i < loopCount1; i++) {
                Consumer.consume(bench.fromBigUint32Array());
            }
            elapsedMs = (Date.now() as long) - start;
            ops += loopCount1;
        }
        totalOps += ops;
        totalMs += elapsedMs;
        log(phase + " " + iter + ":" + ops + " ops, " + 1.0*elapsedMs*MS2NS/ops + " ns/op");
        iter++
    }
}

let bench = new ArrayMethods();

function main(): void throws {

    log("Startup execution started: " + (Date.now() as long));

    
    bench.setup();

    if (FI > 0) {
        log('Fast starting ArrayMethods_fromBigUint32Array @ No Params...');
        let start: long = Chrono.nanoNow();
        for(let i: int = 0; i < FI; i++) {
            Consumer.consume(bench.fromBigUint32Array());
        }
        let elapsed: long = Chrono.nanoNow() - start;
        if (elapsed <= 0) {
            elapsed = 1;  // 0 is invalid result
        }
        log("Benchmark result: ArrayMethods_fromBigUint32Array " + 1.0*elapsed/FI);
        Consumer.consume(bench);
        return;
    }

    log('Starting ArrayMethods_fromBigUint32Array @ No Params...');

    let iterMs: long = 1 * S2MS;
    let loopMs: long = 0;
    let loopCount: long = 1;

    while (loopMs < iterMs && loopCount < MAX_LOOP_COUNT) {
        loopCount = loopCount * 2;
        let start: long = Date.now() as long;
        for (let i = 0; i < loopCount; i++) {
            Consumer.consume(bench.fromBigUint32Array());
        }
        loopMs = (Date.now() as long) - start;
    }

    loopCount1 = loopCount * iterMs / loopMs;
    if (loopCount1 == 0) {
        loopCount1++;
    }

    log("Tuning: " +  loopCount + " ops, " + 1.0*loopMs*MS2NS/loopCount + " ns/op => "
        + loopCount1 + " reps");

    if (WI > 0) {
        iter = 1;
        // Re-entering runIters in warmup loop to allow profiler complete the method.
        // Possible deoptimizations and recompilations is done in warmup instead of measure phase.
        for (let wi: int = 0; wi < WI; ++wi) {
            runIters("Warmup", 1, WT);
        }
    }
    iter = 1;
    runIters("Iter", MI, IT);
    log("Benchmark result: ArrayMethods_fromBigUint32Array " + 1.0*totalMs*MS2NS/totalOps);


    Consumer.consume(bench);

}

class Consumer {
    public static readonly x1: long = 0x41c64e6d;
    public static readonly x2: long = 0xd431;
    private static x3: long = 1;
    public static boola: boolean = false;
    public static boolb: boolean = true;
    public static chara: char = 88;  // 'X'
    public static charb: char = 89;  // 'Y'
    public static stra: string = 'X';
    public static strb: string = 'Y';
    public static bytea: byte = 24;
    public static byteb: byte = 53;
    public static shorta: short = 24;
    public static shortb: short = 53;
    public static inta: int = 24;
    public static intb: int = 53;
    public static longa: long = 24;
    public static longb: long = 53;
    public static floata: float = 24.0;
    public static floatb: float = 53.0;
    public static doublea: double = 24.0;
    public static doubleb: double = 53.0;
    public static localObj = new Object();
    public static localObjs: Object[] = [new Object()];
    public static pseudorand: long = Date.now() as long;

    public static consumeBool(boolc: boolean): void throws {
        if (boolc == Consumer.boola && boolc == Consumer. boolb) {
            throw new NullPointerError();
        }
    }

    public static consumeChar(charc: char): void throws {
        if (charc == Consumer.chara && charc == Consumer.charb) {
            throw new NullPointerError();
        }
    }

    public static consumeByte(bytec: byte): void throws {
        if (bytec == Consumer.bytea && bytec == Consumer.byteb) {
            throw new NullPointerError();
        }
    }

    public static consumeShort(shortc: short): void throws {
        if (shortc == Consumer.shorta && shortc == Consumer.shortb) {
            throw new NullPointerError();
        }
    }

    public static consumeInt(intc: int): void throws {
        if (intc == Consumer.inta && intc == Consumer.intb) {
            throw new NullPointerError();
        }
    }

    public static consumeLong(longc: long): void throws {
        if (longc == Consumer.longa && longc == Consumer.longb) {
            throw new NullPointerError();
        }
    }

    public static consumeFloat(floatc: float): void throws {
        if (floatc == Consumer.floata && floatc == Consumer.floatb) {
            throw new NullPointerError();
        }
    }

    public static consumeDouble(doublec: double): void throws {
        if (doublec == Consumer.doublea && doublec == Consumer.doubleb) {
            throw new NullPointerError();
        }
    }

    public static consumeObj(obj: Object): void throws {
        Consumer.pseudorand = (Consumer.pseudorand * Consumer.x1 + Consumer.x2);
        if ((Consumer.pseudorand & Consumer.x3) == 0) {
            Consumer.x3 = (Consumer.x3 << 1) + (0xad as long);
            Consumer.localObj = obj;
        }
    }

    public static consumeString(strc: string): void throws {
        if (strc === Consumer.stra && strc === Consumer.strb) {
            throw new NullPointerError();
        }
    }

    public static consumeObjs(objs: Object[]): void throws {
        Consumer.pseudorand = (Consumer.pseudorand * Consumer.x1 + Consumer.x2);
        if ((Consumer.pseudorand & Consumer.x3) == 0) {
            Consumer.x3 = (Consumer.x3 << 1) + (0xad as long);
            Consumer.localObjs = objs;
        }
    }

    public static consume(v: boolean): void throws {
        Consumer.consumeBool(v);
    }

    public static consume(v: byte): void throws {
        Consumer.consumeByte(v);
    }

    public static consume(v: char): void throws {
        Consumer.consumeChar(v);
    }

    public static consume(v: short): void throws {
        Consumer.consumeShort(v);
    }

    public static consume(v: int): void throws {
        Consumer.consumeInt(v);
    }

    public static consume(v: long): void throws {
        Consumer.consumeLong(v);
    }

    public static consume(v: float): void throws {
        Consumer.consumeFloat(v);
    }

    public static consume(v: double): void throws {
        Consumer.consumeDouble(v);
    }

    public static consume(v: Object): void throws {
        Consumer.consumeObj(v);
    }

    public static consume(v: Object[]): void throws {
        Consumer.consumeObjs(v);
    }

}

/*
../out/bin/ark_aot --load-runtimes=ets --boot-panda-files=../out/plugins/ets/etsstdlib.abc --paoc-panda-files=../out/plugins/ets/etsstdlib.abc --paoc-output=../out/plugins/ets/etsstdlib.an --paoc-generate-symbols --compiler-disasm-dump


../out/bin/ark_aot --load-runtimes=ets --boot-panda-files=../out/plugins/ets/etsstdlib.abc --paoc-panda-files=bench_ArrayMethods_fillLong.abc --paoc-output=bench_ArrayMethods_fillLong.an --paoc-use-cha=true --compiler-dump:final --paoc-generate-symbols

../out/bin/ark --boot-panda-files=../out/plugins/ets/etsstdlib.abc --load-runtimes=ets --compiler-enable-jit=false --gc-trigger-type=heap-trigger --aot-files=bench_ArrayMethods_fillLong.an --enable-an:force bench_ArrayMethods_fillLong.abc bench_ArrayMethods_fillLong.ETSGLOBAL::main

void arrayfill.ETSGLOBAL::main():
assembler code for function EscompatArrayFillInternalFast:

../out/bin/ark --boot-panda-files=./etsstdlib.abc --load-runtimes=ets --compiler-enable-jit=false --gc-trigger-type=heap-trigger --aot-files=bench_ArrayMethods_fillLong.an  bench_ArrayMethods_fillLong.abc bench_ArrayMethods_fillLong.ETSGLOBAL::main

/mnt/data/l00483465/20250328_ark_blue/arkcompiler/runtime_core/static_core/out/bin/ark --boot-panda-files=/mnt/data/l00483465/20250328_ark_blue/arkcompiler/runtime_core/static_core/out/plugins/ets/etsstdlib.abc --load-runtimes=ets --compiler-enable-jit=false --gc-trigger-type=heap-trigger --aot-files=/mnt/data/l00483465/20250328_ark_blue/arkcompiler/runtime_core/static_core/disasm_stdlib/bench_ArrayMethods_fillLong.an --enable-an:force   /mnt/data/l00483465/20250328_ark_blue/arkcompiler/runtime_core/static_core/disasm_stdlib/bench_ArrayMethods_fillLong.abc bench_ArrayMethods_fillLong.ETSGLOBAL::main

../out/bin/ark_aot --load-runtimes=ets --boot-panda-files=../out/plugins/ets/etsstdlib.abc --paoc-panda-files=bench_Uint32ArrayMethods_longFill.abc --paoc-output=bench_Uint32ArrayMethods_longFill.an --paoc-use-cha=true --compiler-dump:final --paoc-generate-symbols

/mnt/data/l00483465/20250328_ark_blue/arkcompiler/runtime_core/static_core/out/bin/ark --boot-panda-files=/mnt/data/l00483465/20250328_ark_blue/arkcompiler/runtime_core/static_core/out/plugins/ets/etsstdlib.abc --load-runtimes=ets --compiler-enable-jit=false --gc-trigger-type=heap-trigger --aot-files=/mnt/data/l00483465/20250328_ark_blue/arkcompiler/runtime_core/static_core/disasm_stdlib/bench_Uint32ArrayMethods_longFill.an --enable-an:force  --interpreter-type=cpp /mnt/data/l00483465/20250328_ark_blue/arkcompiler/runtime_core/static_core/disasm_stdlib/bench_Uint32ArrayMethods_longFill.abc bench_Uint32ArrayMethods_longFill.ETSGLOBAL::main

hdc shell "/system/bin/ark_aot --load-runtimes=ets --boot-panda-files=/system/etc/etsstdlib.abc --paoc-panda-files=/system/etc/etsstdlib.abc --paoc-output=/system/etc/etsstdlib.an --paoc-generate-symbols --compiler-disasm-dump"
/system/bin/ark_aot --load-runtimes=ets --boot-panda-files=/system/etc/etsstdlib.abc --paoc-panda-files=bench_ArrayMethods_fromBigUint32Array.abc --paoc-output=bench_ArrayMethods_fromBigUint32Array.an --paoc-use-cha=true --compiler-dump:final --paoc-generate-symbols
/system/bin/ark --boot-panda-files=/system/etc/etsstdlib.abc --load-runtimes=ets --compiler-enable-jit=false --gc-trigger-type=heap-trigger --aot-files=bench_ArrayMethods_fromBigUint32Array.an --enable-an:force bench_ArrayMethods_fromBigUint32Array.abc bench_ArrayMethods_fromBigUint32Array.ETSGLOBAL::main

/system/bin/ark_aot --load-runtimes=ets --boot-panda-files=/system/etc/etsstdlib.abc --paoc-panda-files=bench_ArrayMethods_fromBigFloat64Array.abc --paoc-output=bench_ArrayMethods_fromBigFloat64Array.an --paoc-use-cha=true --compiler-dump:final --paoc-generate-symbols
/system/bin/ark --boot-panda-files=/system/etc/etsstdlib.abc --load-runtimes=ets --compiler-enable-jit=false --gc-trigger-type=heap-trigger --aot-files=bench_ArrayMethods_fromBigFloat64Array.an --enable-an:force bench_ArrayMethods_fromBigFloat64Array.abc bench_ArrayMethods_fromBigFloat64Array.ETSGLOBAL::main
 */













/**
 * @State
 * @Generator gen_test_class.py
 * @Tags StdLib, StdLib_Array
 */
export class ArrayMethods {
  shortSize: number;
  longSize: number;
  popSize: number;
  shortNumberArray: Array<number> = new Array<number>();
  longNumberArray: Array<number> = new Array<number>();
  shortNumberArrayForSearch: Array<number> = new Array<number>();
  longNumberArrayForSearch: Array<number> = new Array<number>();
  shortBoxedNumberArray: Array<Number> = new Array<Number>();
  longBoxedNumberArray: Array<Number> = new Array<Number>();
  shortStringArray: Array<string> = new Array<string>();
  longStringArray: Array<string> = new Array<string>();
  arrayPop: Array<number> = new Array<number>();
  atPointShort: number;
  atPointLong: number;
  searchValueShort: number;
  searchValueLong: number;
  basicNumber: number;
  basicString: string = "";
  beginPointShort: number;
  endPointShort: number;
  targetPointShort: number;
  beginPointLong: number;
  endPointLong: number;
  targetPointLong: number;
  keysIteratorMoveCount: number;
  arrayForFlat: Array<Array<number> > = new Array<Array<number> >();
  pushElementsCountSmall: number;
  pushElementsCountBig: number;
  popElementsCountSmall: number;
  popElementsCountBig: number;
  smallFromArray: Array<number> = new Array<number>();
  bigFromArray: Array<number> = new Array<number>();
  smallFromBigInt64Array: BigInt64Array = new BigInt64Array();
  bigFromBigInt64Array: BigInt64Array = new BigInt64Array();
  smallFromBigUint64Array: BigUint64Array = new BigUint64Array();
  bigFromBigUint64Array: BigUint64Array = new BigUint64Array();
  smallFromFloat32Array: Float32Array = new Float32Array();
  bigFromFloat32Array: Float32Array = new Float32Array();
  smallFromFloat64Array: Float64Array = new Float64Array();
  bigFromFloat64Array: Float64Array = new Float64Array();
  smallFromInt16Array: Int16Array = new Int16Array();
  bigFromInt16Array: Int16Array = new Int16Array();
  smallFromInt32Array: Int32Array = new Int32Array();
  bigFromInt32Array: Int32Array = new Int32Array();
  smallFromInt8Array: Int8Array = new Int8Array();
  bigFromInt8Array: Int8Array = new Int8Array();
  smallFromMap: Map<number, number> = new Map<number, number>();
  bigFromMap: Map<number, number> = new Map<number, number>();
  smallFromSet: Set<number> = new Set<number>();
  bigFromSet: Set<number> = new Set<number>();
  smallFromString: String = "";
  bigFromString: String = "";
  smallFromUint16Array: Uint16Array = new Uint16Array();
  bigFromUint16Array: Uint16Array = new Uint16Array();
  smallFromUint32Array: Uint32Array = new Uint32Array();
  bigFromUint32Array: Uint32Array = new Uint32Array();
  smallFromUint8Array: Uint8Array = new Uint8Array();
  bigFromUint8Array: Uint8Array = new Uint8Array();
  smallFromUint8ClampedArray: Uint8ClampedArray = new Uint8ClampedArray();
  bigFromUint8ClampedArray: Uint8ClampedArray = new Uint8ClampedArray();
  delta: number;
  index: number;
  ctorShortPoint: number;
  ctorLongPoint: number;
  ctorShortNumberArray: Array<number> = new Array<number>();
  ctorLongNumberArray: Array<number> = new Array<number>();
  ofShortPoint: number;
  ofLongPoint: number;
  ofShortNumberArray: Array<number> = new Array<number>();
  ofLongNumberArray: Array<number> = new Array<number>();
  forEachShortPoint: number;
  forEachLongPoint: number;

  public setupShortNumberArray(): void {
    this.shortNumberArray = new Array<number>(this.shortSize);
    this.shortNumberArray.fill(this.basicNumber);
  }

  public setupLongNumberArray(): void {
    this.longNumberArray = new Array<number>(this.longSize);
    this.longNumberArray.fill(this.basicNumber);
  }

  public setupContainersForFrom() {
    this.smallFromArray = new Array<number>(this.shortSize);
    this.smallFromArray.fill(1);
    this.bigFromArray = new Array<number>(this.longSize);
    this.bigFromArray.fill(1);
    this.smallFromBigInt64Array = new BigInt64Array(this.shortSize);
    this.bigFromBigInt64Array = new BigInt64Array(this.longSize);
    this.smallFromBigUint64Array = new BigUint64Array(this.shortSize);
    this.bigFromBigUint64Array = new BigUint64Array(this.longSize);
    this.smallFromFloat32Array = new Float32Array(this.shortSize);
    this.bigFromFloat32Array = new Float32Array(this.longSize);
    this.smallFromFloat64Array = new Float64Array(this.shortSize);
    this.bigFromFloat64Array = new Float64Array(this.longSize);
    this.smallFromInt16Array = new Int16Array(this.shortSize);
    this.bigFromInt16Array = new Int16Array(this.longSize);
    this.smallFromInt32Array = new Int32Array(this.shortSize);
    this.bigFromInt32Array = new Int32Array(this.longSize);
    this.smallFromInt8Array = new Int8Array(this.shortSize);
    this.bigFromInt8Array = new Int8Array(this.longSize);
    this.smallFromMap = new Map<number, number>();
    this.bigFromMap = new Map<number, number>();
    this.smallFromSet = new Set<number>();
    this.bigFromSet = new Set<number>();
    for (let i: number = 0; i < this.shortSize; i++) {
      this.smallFromMap.set(i, i);
      this.smallFromSet.add(i);
    }
    for (let i: number = 0; i < this.longSize; i++) {
      this.bigFromMap.set(i, i);
      this.bigFromSet.add(i);
    }
    try {
      this.smallFromString = "a".repeat(this.shortSize);
      this.bigFromString = "a".repeat(this.longSize);
    } catch (e) {
    }
    this.smallFromUint16Array = new Uint16Array(this.shortSize);
    this.bigFromUint16Array = new Uint16Array(this.longSize);
    this.smallFromUint32Array = new Uint32Array(this.shortSize);
    this.bigFromUint32Array = new Uint32Array(this.longSize);
    this.smallFromUint8Array = new Uint8Array(this.shortSize);
    this.bigFromUint8Array = new Uint8Array(this.longSize);
    this.smallFromUint8ClampedArray = new Uint8ClampedArray(this.shortSize);
    this.bigFromUint8ClampedArray = new Uint8ClampedArray(this.longSize);
  }

  /**
   * @Setup
   */
  public setup(): void {
    this.shortSize = 10;
    this.longSize = 10000;
    this.popSize = 1000000;
    this.setupContainersForFrom();
    this.pushElementsCountSmall = 20;
    this.pushElementsCountBig = 20000;
    this.popElementsCountSmall = 8;
    this.popElementsCountBig = 8000;
    this.keysIteratorMoveCount = 8000;
    this.setupShortNumberArray();
    this.setupLongNumberArray();
    this.shortStringArray = new Array<string>();
    this.longStringArray = new Array<string>();
    this.shortNumberArrayForSearch = new Array<number>();
    this.longNumberArrayForSearch = new Array<number>();
    this.shortBoxedNumberArray = new Array<Number>();
    this.longBoxedNumberArray = new Array<Number>();
    this.atPointShort = 4;
    this.atPointLong = 2000;
    this.searchValueShort = 5;
    this.searchValueLong = 5000;
    this.basicNumber = 5;
    this.basicString = "abacabaabacaba";
    this.arrayForFlat = new Array<Array<number> >();
    for (let i: number = 0; i < this.shortSize; i++) {
      this.shortNumberArrayForSearch.push(i);
      this.shortBoxedNumberArray.push(i);
      this.shortStringArray.push(this.basicString);
    }
    for (let i: number = 0; i < this.longSize; i++) {
      this.longNumberArrayForSearch.push(i);
      this.longBoxedNumberArray.push(i);
      this.longStringArray.push(this.basicString);
    }
    this.arrayPop = new Array<number>();
    for (let i: number = 0; i < this.popSize; i++) {
      this.arrayPop.push(i);
    }
    this.beginPointShort = 4;
    this.endPointShort = 7;
    this.targetPointShort = 2;
    this.beginPointLong = 4000;
    this.endPointLong = 7000;
    this.targetPointLong = 2000;
    for (let i: number = 0; i < this.shortSize; i++) {
      let array: Array<number> = new Array<number>();
      for (let j: number = 0; j < this.shortSize; j++) {
        array.push(j);
      }
      this.arrayForFlat.push(array);
    }

    this.delta = 0.000000001;
    this.index = 0;
  }



ArrayMethods_fromBigArray
ArrayMethods_fromBigFloat64Array
ArrayMethods_fromBigFloat32Array
ArrayMethods_fromBigInt16Array
ArrayMethods_fromBigInt8Array
ArrayMethods_fromBigInt32Array
ArrayMethods_fromBigUint8Array
ArrayMethods_fromBigUint16Array
ArrayMethods_fromBigUint8ClampedArray
ArrayMethods_fromBigUint32Array
ArrayMethods_fromBigBigInt64Array
ArrayMethods_fromSmallArray
ArrayMethods_fromSmallUint8Array
ArrayMethods_fromSmallFloat32Array
ArrayMethods_fromSmallFloat64Array
ArrayMethods_fromSmallInt8Array
ArrayMethods_fromSmallInt16Array
ArrayMethods_fromSmallInt32Array
ArrayMethods_fromSmallUint16Array
ArrayMethods_fromSmallUint8ClampedArray
ArrayMethods_fromSmallUint32Array
ArrayMethods_fromSmallBigInt64Array
ArrayMethods_fromSmallBigUint64Array
ArrayMethods_fromBigBigUint64Array
ArrayMethods_fromBigSet





